#ifndef DATANBASE_OBJECT_H
#define DATANBASE_OBJECT_H

#include "../Paser.hpp"
#include "../Tool.hpp"
#include "../../base/TimeUnit.hpp"

#include <string>

/* the base class of all the database data structor */
namespace DBServer
{
namespace Database
{
class Object {
public:

    Object(int _object_type);
    ~Object() = default;

    virtual void command_excute(CommandRespond& rep, CommandRequest&& req, com_func_t& cft) = 0;

    std::string get_type();
    unsigned long long get_expire();
    void set_expire(unsigned long long);
    bool timeout();

    int type_info()
    {
        return object_type;
    }

private:
    int object_type;      // the type name of the dervice structor
    bool time;
    static const char *object_name[5]; // the name of the object type

    /* key expire time */
    DBServer::Base::Timer::Time timer;
};

} // namespace DataBase    
} // namespace DBServer



#endif